// from http://williamsportwebdeveloper.com/cgi/wp/?p=503
// 6 Ways To Work With Dates In JavaScript
 
function padzero(n) {
    return n < 10 ? '0' + n : n;
}
 
function pad2zeros(n) {
    if (n < 100) {
        n = '0' + n;
    }
    if (n < 10) {
        n = '0' + n;
    }
    return n;     
}
 
function toISOString(d) {
    return d.getUTCFullYear() + '-' +  padzero(d.getUTCMonth() + 1) + '-' + padzero(d.getUTCDate()) + 'T' + padzero(d.getUTCHours()) + ':' +  padzero(d.getUTCMinutes()) + ':' + padzero(d.getUTCSeconds()) + 'Z';
}
 
function toSmallDate(d){
	return padzero(d.getUTCDate()) + ' ' + padzero(d.getUTCMonth() + 1);
}

function fnToISO(d) {
    var now = new Date(d);
    var postDate = toISOString(now);
    return postDate;
}

function fnToSmallDate(d){
	var now = new Date(d);
	var postDate = toSmallDate(now);
	return postDate;
}